import html2canvas from 'html2canvas'
import { createApp, h } from 'vue'
import { Component } from 'vue'
export const renderComponentAsImage = async (component: Component) => {
	const componentInstance = h(component)
	const app = createApp({ render: () => componentInstance })
	const vm = app.mount(document.createElement('div'))

	const canvas = await html2canvas(vm.$el)
	const image = canvas.toDataURL('image/png')

	return image
}
